CICommandQuery

The CICommandQuery component gives a plug-in access to the PageMaker parameter block, which is the mechanism used to execute commands and queries.

We strongly recommend that you use the PageMaker Class Library to send commands and queries to the application. If you use the PageMaker Class Library and its template source files, you should not have to be concerned with acquiring and releasing the CICommandQuery interface.


Acquiring the CICommandQuery component

To use the CICommandQuery component, you must first acquire it using the CIInterfaceManager component passed to your plug-in as part of the PMMessage structure.

PMXErr main(PMMessage *pMsg)
{
    CIInterfaceManager * pIntfMgr = pMsg->pInterfaceMgr;
    CICommandQuery     * pCmdQry;
    pIntfMgr->AcquirePMInterface(PMIID_CMDQRY,(void **) &pCmdQry);
    ...

When you have finished using the CICommandQuery component, you must release it:

    pIntrMgr->ReleasePMInterface((void **) pCmdQry);


CICommandQuery functions

The CICommandQuery interface contains two functions.

PMXErr Retrieve(sPMParamBlockPtr *lpPB);

This function retrieves the command and query parameter block. This structure can then be used to make command and query callbacks into PageMaker. Refer to the PageMaker Class Library for more information about specific commands and queries.

void ErrorAlert(PMXErr err, sPMParamBlockPtr lpParamBlock);

The ErrorAlert function provides a way to report an error back to PageMaker in the event a problem occurs when using commands or queries.

You can supply either one or two two messages, separated by a null character. Regardless of whether the error string contains one or two messages, it must end with two null characters. For example:

<String1><NULL><NULL>

or

<String1><NULL><String2><NULL><NULL>

If the plug-in supplies one error message, PageMaker displays "Plug-in error: Plug-in cannot be completed" followed by the plug-in message.

The error strings are passed to PageMaker through lpParamBlock structure (a pointer to the error strings is put in errMessage.)

For more information about error reporting with commands and queries, refer to the PCL documentation.


Copyright © 1996, Adobe Systems Incorporated. All rights reserved.

Comments or suggestions? Contact Adobe Developer Support